package com.ja.openchat.viewmodels;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.ja.openchat.ui.chat.PreviewWebViewActivity;
import com.zy.openchat.core.model.discover.DiscoverMenuInfo;

import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;


public class FoundItemViewModel extends MultiItemViewModel<FoundViewModel> {
    public ObservableField<DiscoverMenuInfo> entity = new ObservableField<>();

    public FoundItemViewModel(@NonNull FoundViewModel application, DiscoverMenuInfo entity) {
        super(application);
        this.entity.set(entity);
    }

    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("url", entity.get().url);
            bundle.putString("title", "");
            viewModel.startActivity(PreviewWebViewActivity.class, bundle);
        }
    });
}
